#!/usr/bin/python2.5
# get information from nodes and check alarm limits

import os
import sys
import telnetlib
from fetcher import *
from state import MuninNodeState

from processor import HuninProcessor

import pickle

processor = HuninProcessor([('localhost', 4949)])



email = ""

for host, diff in processor.get_diffs().iteritems():
  email+= "======\n%s:%u:\n\n" % host
  email+= diff.__str__()+"\n"

if len(email) == 0:
  sys.exit()


  
p = os.popen("/usr/bin/mail -s 'hunin notification' user@example.com", 'w')
p.write(email)
exitcode = p.close()
if exitcode:
  print "mail exit code: %s" % exitcode

